<template>
  <view v-if="Object.keys(detailInfo).length !== 0" class="goods-info">
    <view class="info-desc clear-fix">
      <view class="start"></view>
      <view class="desc">{{detailInfo.desc}}</view>
      <view class="end"></view>
    </view>
    <view class="info-key">{{detailInfo.detailImage[0].key}}</view>
    <view class="info-list">
      <image v-for="(item, index) in detailInfo.detailImage[0].list" 
						 :src="item" 
						 :key="index" 
						 mode="widthFix" 
						 alt="" 
						 @load="imgGoodsInfoLoad">
    </view>
  </view>
</template>

<script>
export default {
  name: "DetailGoodsInfo",
  props: {
    detailInfo: {
      type: Object
    }
  },
  data(){
    return {
      counter: 0,
      imgLength: 0
    }
  },
  methods: {
    imgGoodsInfoLoad(){
      if(++this.counter  == this.detailInfo.detailImage[0].list.length){
        this.$emit('imgGoodsInfoLoad')
      }
    }
  },
  // watch: {
  //   detailInfo(){
  //     this.imgLength = this.detailInfo.detailImage[0].list.length
  //   }
  // }
}
</script>

<style lang="scss">
.goods-info {
  padding: 20px 0;
  border-bottom: 5px solid #f2f5f8;
}

.info-desc {
  padding: 0 15px;
}

.info-desc .start, .info-desc .end {
  width: 90px;
  height: 1px;
  background-color: #a3a3a5;
  position: relative;
}

.info-desc .start {
  float: left;
}

.info-desc .end {
  float: right;
}

.info-desc .start::before, .info-desc .end::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  background-color: #333;
  bottom: 0;
}

.info-desc .end::after {
  right: 0;
}

.info-desc .desc {
  padding: 15px 0;
  font-size: 14px;
}

.info-key {
  margin: 10px 0 10px 15px;
  color: #333;
  font-size: 15px;
}

.info-list  {
  width: 750rpx;
	image{
		width: 100%;
	}
}
</style>
